package com.sojson.util.pay.wx.bean;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.sojson.base.impl.BaseUtilDto;
import com.sojson.config.exception.TransErrorCode;
import com.sojson.config.exception.bean.Status;

import lombok.Data;

/**
 * 微信普通接口响应Bean
 * 
 * @author liu
 * @date 2021-03-16
 */
@Data
public class WxBaseResponse extends BaseUtilDto {

    /***/
    private static final long serialVersionUID = -444894164284969796L;

    /** 错误码 */
    @JsonIgnore
    private String errcode;
    /** 错误信息 */
    @JsonIgnore
    private String errmsg;
    /** 统一状态Bean */
    private Status cusStatus;

    public WxBaseResponse() {}

    /**
     * 成功返回
     * 
     * @param code
     */
    public WxBaseResponse(Integer code) {
        this(code, null);
    }

    /**
     * 返回失败
     * 
     * @param code
     * @param msg
     */
    public WxBaseResponse(Integer code, String msg) {
        this(new Status(code, msg));
    }

    /**
     * 返回失败
     * 
     * @param transErrorCode
     */
    public WxBaseResponse(TransErrorCode transErrorCode) {
        this(new Status(transErrorCode.getCode(), transErrorCode.getMsg()));
    }

    public WxBaseResponse(Status status) {
        setCusStatus(status);
    }

}